package com.gitee.swsk33.dbproduct.api;

import com.gitee.swsk33.dbentity.dataobject.Product;
import com.gitee.swsk33.dbentity.model.Result;
import com.gitee.swsk33.dbproduct.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/api/product")
public class ProductAPI {

	@Autowired
	private ProductService productService;

	@GetMapping("/get/{id}")
	public Result<Product> getById(@PathVariable int id) {
		return productService.getById(id);
	}

	@PostMapping("/get-batch")
	public Result<List<Product>> getByBatchId(@RequestBody List<Integer> ids) {
		return productService.getByBatchId(ids);
	}

}